package edu.hit.stu.controller.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 用户信息
 */
@ApiModel(description = "用户信息")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2021-07-05T22:57:48.433602500+08:00[Asia/Shanghai]")
public class User {
  @JsonProperty("username")
  private String username;

  @JsonProperty("password")
  private String password;

  @JsonProperty("nickname")
  private String nickname;

  @JsonProperty("authorities")
  @Valid
  private List<String> authorities = null;

  public User username(String username) {
    this.username = username;
    return this;
  }

  /**
   * 账户
   * @return username
  */
  @ApiModelProperty(example = "171110313", value = "账户")


  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public User password(String password) {
    this.password = password;
    return this;
  }

  /**
   * 密码
   * @return password
  */
  @ApiModelProperty(example = "7jV_Ne9p_b:8cXY", value = "密码")


  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public User nickname(String nickname) {
    this.nickname = nickname;
    return this;
  }

  /**
   * 用户昵称
   * @return nickname
  */
  @ApiModelProperty(example = "zhang GouDan", value = "用户昵称")


  public String getNickname() {
    return nickname;
  }

  public void setNickname(String nickname) {
    this.nickname = nickname;
  }

  public User authorities(List<String> authorities) {
    this.authorities = authorities;
    return this;
  }

  public User addAuthoritiesItem(String authoritiesItem) {
    if (this.authorities == null) {
      this.authorities = new ArrayList<>();
    }
    this.authorities.add(authoritiesItem);
    return this;
  }

  /**
   * 权限列表
   * @return authorities
  */
  @ApiModelProperty(value = "权限列表")


  public List<String> getAuthorities() {
    return authorities;
  }

  public void setAuthorities(List<String> authorities) {
    this.authorities = authorities;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    User user = (User) o;
    return Objects.equals(this.username, user.username) &&
        Objects.equals(this.password, user.password) &&
        Objects.equals(this.nickname, user.nickname) &&
        Objects.equals(this.authorities, user.authorities);
  }

  @Override
  public int hashCode() {
    return Objects.hash(username, password, nickname, authorities);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class User {\n");
    
    sb.append("    username: ").append(toIndentedString(username)).append("\n");
    sb.append("    password: ").append(toIndentedString(password)).append("\n");
    sb.append("    nickname: ").append(toIndentedString(nickname)).append("\n");
    sb.append("    authorities: ").append(toIndentedString(authorities)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}

